<template>
  <view class="page">
    <!-- 搜索框卡片 -->
    <view class="search-card">
      <uni-title style="margin-left: 14px;" type="h2" title="关键词查询"></uni-title>
      <uni-search-bar placeholder="请输入企业名/受理号查询" @confirm="onSearch"></uni-search-bar>

      <uni-title style="margin-left: 14px; margin-top: 10px" type="h2" title="工单状态"></uni-title>

      <!-- 工单状态选择器 -->
      <view class="status-selector">
        <view class="selector-container">
          <uni-data-checkbox v-model="radio1" :localdata="hobby"></uni-data-checkbox>
        </view>
      </view>
    </view>

    <!-- 查询结果表格 -->
    <view class="query-result">
      <uni-title style="margin-left: 14px;" type="h2" title="查询结果"></uni-title>
     <view class="table-row"></view>
	  <uni-row class="demo-uni-row">
        <uni-col span="12">
          <view style="margin: 14px;font-size: 14px;">审查企业名：珠海绿网食品医疗器械有限公司</view>
        </uni-col>
        <uni-col span="12">
          <view style="text-align: right; margin: 14px; font-size: 14x;">受理号：123456</view>
        </uni-col>
      </uni-row>

      <view class="table-header">
        <view>工单名称</view>
        <view>编辑时间</view>
        <view>工单状态</view>
        <view>操作</view>
       
      </view>
      <view class="table-row" v-for="(item, index) in queryResults" :key="index">
        <view>{{ item.name }}</view>
        <view>{{ item.editTime }}</view>
        <view>{{ item.status }}</view>
        <view>{{ item.operation }}</view>
      </view>
	    <view class="table-row"></view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      radio1: 0,
      queryResults: [
        { name: '工单1', editTime: '2024/09/18 12:53:41', status: '已完成', operation: '查看详情', receiptNumber: '123456' },
        { name: '工单2', editTime: '2024/09/18 16:11:50', status: '未完成', operation: '继续处理', receiptNumber: '789012' },
        { name: '工单3', editTime: '2024/09/18 19:53:20', status: '未完成', operation: '继续处理', receiptNumber: '345678' }
      ],
      hobby: [
        { text: '全部工单', value: 0 },
        { text: '已完成工单', value: 1 },
        { text: '未完成工单', value: 2 }
      ]
    };
  },
  methods: {
    goBack() {
      uni.navigateBack();
    },
    onSearch(event) {
      console.log('搜索内容:', event.detail.value);
      // Handle search logic here
    }
  }
};
</script>

<style scoped>
.page {
  background-color: #e9f1fe;
  padding: 20px;
  height: 100vh; /* 使背景占满整个屏幕 */
  display: flex;
  flex-direction: column;
}

.search-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  margin-bottom: 20px;
}

.status-selector {
  border: 1px dashed #ccc;
  border-radius: 8px;
  padding: 10px;
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 20px;
  background-color: #ffffff;
}

.selector-container {
  display: flex;
  justify-content: space-around;
}

.query-result {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 20px;
  flex-grow: 1; /* 使查询结果区域占据剩余空间 */
}

.table-header {
  display: flex;
  justify-content: space-between; /* 调整为两端对齐 */
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  margin-left: 10px;
  font-size: 14px;
}

.table-row {
  display: flex;
  margin-left: 10px;
  justify-content: space-between; /* 调整为两端对齐 */
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px dashed #ddd;
}

.table-row:last-child {
  border-bottom: none;
}
</style>



